﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Teal.Compiler.UnitTest {

    public class TestBase :IReporter {

        public static string testCasesPath = Path.Combine(Path.GetDirectoryName(typeof(TestBase).Assembly.Location), "../../Src/TealCompiler.UnitTest/Tests/");

        public string readSource(string fileName) {
            return File.ReadAllText(testCasesPath + fileName);
        }

        public TestBase() {
            Compiler.reportor = this;
        }

        List<Tuple<ErrorCode, string, Location, Location>> _errroList = new List<Tuple<ErrorCode, string, Location, Location>>();

        public void error(ErrorCode number, string message, Location startLocation, Location endLocation) {
            _errroList.Add(new Tuple<ErrorCode, string, Location, Location>(number, message, startLocation, endLocation));
        }

        public void warning(ErrorCode number, string message, Location startLocation, Location endLocation) {
            _errroList.Add(new Tuple<ErrorCode, string, Location, Location>(number, message, startLocation, endLocation));
        }

        public void echo(string message, Location startLocation, Location endLocation) {
            
        }

        public void clear() {
            _errroList.Clear();
        }
    }
}
